#ifndef CHARACTER_H
#define CHARACTER_H

#include "Entity.h"
#include "Stat.h"
#include "Directions.h"
#include "Item.h"
#include "Inventory.h"

class Character : public Entity {
public:
	Character() {}
	virtual ~Character() {}
	
	virtual void attack(Character* character);
	
	/**
	 *  Take a step in the specified direction. Consumes
	 *  one action point if successful. Two if burdened,
	 *  three if strained. Also one extra if starving.
	 */
	virtual bool step(Direction dir);
	
	inline void resetActionPoints() { m_actionPoints = m_speed.current; }
	inline int remainingActionPoints() const { return m_actionPoints; }
	
	inline const Inventory& inventory() const { return m_inventory; }
	inline Inventory& inventory() { return m_inventory; }
	
	inline int carryingCapacity() const { return m_strength.current * 10; }
	
	/**
	 * Attempt to add an item to the inventory. Costs one action point.
	 * @return True if successfull, false if it weights too much.
	 */
	bool pickup(Item* item);
	
protected:
	enum Condition {
		NORMAL		= 1,
		POISON		= 2,
		SLEEP		= 4,
		PARALYZE	= 8,
		DEAD		= 16,
		INVISIBLE	= 32,
		BURDENED	= 64,
		STRAINED	= 128,
		HUNGRY		= 256,
		STARVING	= 512,
		BLIND		= 1024
	};
	enum Sex {
		MALE,
		FEMALE,
		NEITHER,
		BOTH
	};
protected:
	Stat m_hitPoints;
	Stat m_spellPoints;
	Stat m_strength;
	Stat m_dexterity;
	Stat m_constitution;
	Stat m_willpower;
	Stat m_speed;
	Stat m_level;
	Stat m_experience;
	Condition m_condition;
	Sex m_sex;
	
	int m_actionPoints;
	
	// Gear
	Item* m_weapon;
	Item* m_shield;
	Item* m_armor;
	Item* m_helmet;
	Item* m_boots;
	Item* m_gloves;
	Item* m_cloak;
	Item* m_leftRing, m_rightRing;
	Item* m_amulet;
	
	Inventory m_inventory;
};

#endif